package com.xinyue.exceltool.logic.convert.impl;

import com.xinyue.exceltool.logic.convert.ICellValueTypeStrategy;
import com.xinyue.exceltool.logic.convert.ValueConvertUtil;
import org.springframework.util.StringUtils;

/**
 * @Author 王广帅
 * @Date 2021/5/8 23:50
 */
public class StringArrayConvert implements ICellValueTypeStrategy {
    @Override
    public Object convert(String value) {
        if (StringUtils.isEmpty(value)) {
            return null;
        }
        String tempValue = ValueConvertUtil.replaceChineseComma(value);
        String[] array = ValueConvertUtil.splitByComma(tempValue);
        return array;
    }

    @Override
    public String getJavaFieldTypeName(String type) {
        return "String[]";
    }
}
